package com.test.webtest.controller;

import com.test.webtest.dto.GetPriceDTO;
import com.test.webtest.dto.Result;
import com.test.webtest.service.GetPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Description GetPriceController
 * @Author jiangzhenghao
 * @Date 2025-05-16  19:16
 */
@RestController
public class GetPriceController {

    @Autowired
    private GetPriceService getPriceService;

    @PostMapping("/price")
    public Result getPrice(GetPriceDTO dto) {

        Double total = getPriceService.calculatePrice(dto.getCurrentTime());
        String result = "当前时间：" + dto.getCurrentTime() + "的价格是：" + total;
        return Result.ok(result);
    }
}
